package com.tuanzi.loan.web.lazy.application;

import com.tuanzi.loan.business.entity.application.LoanApplicationExportGroup;
import com.tuanzi.loan.business.service.application.LoanApplicationExportGroupService;
import com.tuanzi.loan.business.service.application.LoanApplicationExportService;
import com.tuanzi.loan.core.lazy.BaseLazyDataModel;
import com.tuanzi.loan.core.util.SpringContextHolder;
import com.tuanzi.loan.core.vo.PageSearcher;
import com.tuanzi.loan.vo.request.application.LoanApplicationExportRequest;
import com.tuanzi.loan.vo.response.application.LoanApplicationExportResponse;
import org.springframework.data.domain.Page;

/**
 * @Auther: hequnayu
 * @Date: 2019/7/31 14:57
 * @Description:
 */
public class LoanApplicationExportLazyDataModel extends BaseLazyDataModel<LoanApplicationExportRequest, LoanApplicationExportResponse> {

    private static final long serialVersionUID = -6563487606762529556L;
    private LoanApplicationExportService exportService = SpringContextHolder.getBean(LoanApplicationExportService.class);
//    private LoanApplicationExportGroupService groupService = SpringContextHolder.getBean(LoanApplicationExportGroupService.class);
    public LoanApplicationExportLazyDataModel(LoanApplicationExportRequest loanApplicationExportRequest) {
        super(loanApplicationExportRequest);
//        if (loanApplicationExportRequest.getExportGroupId() != null){
//            LoanApplicationExportGroup one = groupService.findOne(loanApplicationExportRequest.getExportGroupId().longValue());
//            loanApplicationExportRequest.setExportGroupId(one.getGroupId());
//            loanApplicationExportRequest.setType(one.getType());
//        }
    }
    @Override
    protected Page<LoanApplicationExportResponse> doLoad(PageSearcher<LoanApplicationExportRequest> pageSearcher) {
        Page<LoanApplicationExportResponse> list = exportService.list(pageSearcher);
        return list;
    }
}
